-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add idle timeout #118
add idle timeout #118
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 42.94% 41.94% -1.00%
==========================================
Files 7 7
Lines 482 503 +21
==========================================
+ Hits 207 211 +4
- Misses 275 292 +17 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
# Container has already stopped, return its status code immediately | ||
return status | ||
|
||
last_activity = self.user.last_activity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this must be running in the central hub server since it's polling against possibly stopped containers. Is there a CustomDockerSpawner instance per user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea. each user will have a spawner instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
self.log.info(f"Last activity for {self.container_name}: {last_activity}") | ||
|
||
if last_activity: | ||
idle_time = datetime.utcnow() - last_activity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utcnow()
isn't recommended: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure timezone info isn't necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, both utcnow()
and now()
are working as expected locally. last_activity = self.user.last_activity
doesn't have timezone info either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Co-authored-by: MrCreosote <[email protected]>
No description provided.